﻿using DataScripter.Excel.Formulas;

namespace DataScripter.Excel.Functions
{
	class FutureValue : Formula
	{
		private Formula Rate { get; set; }
		private Formula NumberOfPeriods { get; set; }
		private Formula Payment { get; set; }
		private Formula PresentValue { get; set; }

		public FutureValue(Formula rate, Formula numberOfPeriods, Formula payment, Formula presentValue)
		{
			Rate = rate;
			NumberOfPeriods = numberOfPeriods;
			Payment = payment;
			PresentValue = -presentValue;
		}

		#region Overrides of Formula

		public override string Resolve(ICell current)
		{
			return string.Format(DutchFunctionNames.FV + "({0};{1};{2};{3})", Rate.Resolve(current), NumberOfPeriods.Resolve(current), Payment.Resolve(current), PresentValue.Resolve(current));
		}

		#endregion
	}
}
